## Makefile
##
## Copyright 2006, Brian Swetland.  All rights reserved.
## See provided LICENSE file or http://frotz.net/LICENSE for details.
##

CC      := arm-elf-gcc
OBJCOPY := arm-elf-objcopy
OBJDUMP := arm-elf-objdump

vpath %.c ../library
vpath %.S ../library

CFLAGS  := -O2 -g -Wall -I. -I../library

#CFLAGS  += -mthumb -mthumb-interwork
#ASFLAGS += -mthumb-interwork

TARGET  := test
OBJS    := crt0_ram.o test.o 

all: $(TARGET) $(TARGET).lst

test.o: board.h

board.h: board.def
	../tools/mkboard.py ../library/at91sam7s.pins board.def

$(TARGET).elf: $(OBJS)
	arm-elf-ld --script ../library/ram.ld -o $(TARGET).elf $(OBJS)

$(TARGET): $(TARGET).elf
	$(OBJCOPY) -O binary $(TARGET).elf $(TARGET)

$(TARGET).lst: $(TARGET).elf
	$(OBJDUMP) -d $(TARGET).elf > $(TARGET).lst

clean:
	rm -f *.o *~ *.elf *.lst $(TARGET) board.h

